/**##################### 定义一些全局使用的基础变量 ######################*/
/**
 * 当前服务协议，http: 或 https:
 * @type {string}
 */
var base_protocol = document.location.protocol;

var preUrl = "ws://bdfw.superlib.com:9025/cxts/";
var httpUrl = "http://bdfw.superlib.com:9025/cxts/";
/**
 * 当前服务域名+端口
 * @type {string}
 */
var domain_port = document.domain + ':' + location.port;
/**
 * WebSocket协议
 * @type {string}
 */
var ws_protocol = base_protocol === "https:" ? "wss://" : "ws://";

/**
 * 当前服务项目名
 * @type {string}
 */
var context_path = "/cxts/";

/**##################### 定义WebSocket链接 ######################*/
/**
 * 拖拽首页WebSocket链接
 * @type {string}
 */
var ws_url_drag_index = preUrl + "websocket/drag_index";
/**
 * 模块放大WebSocket链接
 * @type {string}
 */
var ws_url_is_enlarge = preUrl + "websocket/is_enlarge";
/**
 * 借阅排行榜WebSocket链接
 * @type {string}
 */
var ws_url_borrow_rank = preUrl + "websocket/borrow_rank";
/**
 * 借阅统计WebSocket链接
 * @type {string}
 */
var ws_url_borrow_count = preUrl + "websocket/borrow_count";
/**
 * 借阅曲线WebSocket链接
 * @type {string}
 */
var ws_url_borrow_line = preUrl + "websocket/borrow_line";
/**
 * 到馆统计WebSocket链接
 * @type {string}
 */
var ws_url_came_count = preUrl + "websocket/came_count";
/**
 * 通知公告WebSocket链接
 * @type {string}
 */
var ws_url_notice = preUrl + "websocket/notice";
/**
 * 今日推荐WebSocket链接
 * @type {string}
 */
var ws_url_jrtj = preUrl + "websocket/jrtj";
/**
 * 本馆风采WebSocket链接
 * @type {string}
 */
var ws_url_resource = preUrl + "websocket/resource";
/**
 * 名人名言WebSocket链接
 * @type {string}
 */
var ws_url_famous_saying = preUrl + "mobile/ws/famous_saying";
/**
 * 欢迎标语WebSocket链接
 * @type {string}
 */
var ws_url_wel_word = preUrl + "websocket/wel_word";
/**
 * 弹幕功能WebSocket链接 --ZL
 * @type {string}
 */
var ws_url_barrage = preUrl + "websocket/barrage";

/**
 * 根据参数名获取请求路径中的参数值
 * @param key
 */
function fnt_get_url_parameter(key){
    var urlParam = location.search;
    if (urlParam.indexOf("?") != -1){
        var str = decodeURIComponent(urlParam.substr(1));
        var p_arr = str.split("&");
        if (key === '' || key == undefined){
            return p_arr;
        }
        for(var i=0; i<p_arr.length; i++){
            if (p_arr[i].indexOf(key + "=") == 0){
                return p_arr[i].split("=")[1];
            }
        }
        return "";
    }
}